package UserData;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.Serializable;
import java.util.ArrayList;

public class User_Management
  implements Serializable
{
//  public static ArrayList<User_Info> User_list = new ArrayList();
  public static ArrayList<User_Info> Get_User_list = new ArrayList();
  public static User_Info Now_User = null;
  
  public User_Info find_friend(String ID) {
    User_Info answer = null;
    for (User_Info temp : Get_User_list) {
      if (temp.getID().equals(ID)) {
        answer = temp;
      }

    }

    return answer;
  }

  public int Act_user()
  {
    int answer = -1;
    for (User_Info temp : Get_User_list) {
      if (temp.isLogin()) {
        Now_User = temp;

        answer = Get_User_list.indexOf(temp);
      }
    }

    return answer;
  }

  public static void serOut()
  {
    try
    {
      FileOutputStream fos = new FileOutputStream("User.dat");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
      oos.writeObject(Get_User_list);
     // System.out.println("set:   " + Get_User_list.size());
      oos.close(); } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public static void serIn()
  {
  }
}